<template>
    <section>
        <el-tree :data="treeData" :props="defaultProps" show-checkbox node-key="id" @node-click="handleNodeClick"></el-tree>
    </section>
</template>

<script>
    export default {
        data() {
            return {
                treeData: [],
                defaultProps: {
                    children: 'children',
                    label: 'name'
                }
            };
        },
        mounted() {
            this.loadData();
        },
        methods: {
            loadData: function () {
                let _this = this;
                this.httpPostRequest("/oauth/resource/findAll", {}, function (data) {
                    console.log(data);
                    _this.treeData = data;
                });
            },
            handleNodeClick(data) {
                console.log(data);
            }
        }
    };
</script>